﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace GameSchoolApplication.Models
{
	public class Level
	{
        public Level()
        {
            this.Complete = false;
        }
        
        [Key]
		public int LevelId { get; set; }
		public int GameId { get; set; }
        [Display(Name="Titill")]
        public string Title { get; set; }
        public bool Complete { get; set; }

        [ForeignKey("GameId")]
        public virtual Game Game { get; set; }

        public virtual ICollection<Video> Videos { get; set; }
        public virtual ICollection<Test> Tests { get; set; }
        public virtual ICollection<Assignment> Assignments { get; set; }
        public virtual ICollection<StudentLevelPoints> StudentLevelPoints { get; set; }

        public StudentLevelPoints GetStudentParticipation(Person student)
        {
            return StudentLevelPoints.Where(sl => sl.StudentId == student.Id).SingleOrDefault();
        }
	}
}